<#include "../inc/view.html"/>
<@view>
            <form id="menuAddForm${nowtime}" name="menuAddForm" class="form-horizontal" action="/admin/menu/save" method="post" data-validator-option="{theme:'yellow_top'}">
                <input type="hidden" name="sysMenu.id" value="${(po.id)!}">
                <input type="hidden" name="sysMenu.parentid" value="${(po.parentid)!(parentid)!}">
                <input type="hidden" name="sysMenu.levelno" value="${(po.levelno)!levelno!1}">
            <div class="row">
                <div class="col-sm-6">
                    <ol class="breadcrumb">
                        <li>
                            <b>系统</b>
                        </li>
                        <li>
                            <a href="javascript:void(0);" onclick="contentLoadPage('/menu')">菜单</a>
                        </li>
                        <li class="active">
                            <#if po??>修改
                                <#else>新增
                            </#if>
                        </li>
                    </ol>
                </div>
                <div class="col-sm-6">
                    <a onclick="contentLoadPage('/menu')" class="btn-sm btn-white pull-right" style="margin-left:10px;"><i class="ti-arrow-left"></i>返回</a>
                    <button type="submit" class="btn-sm btn-success pull-right"><i class="ti-save"></i>保存</button>
                </div>
            </div>
            <hr>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">菜单/按钮名称</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysMenu.name" data-rule="菜单/按钮名称:required" value="${(po.name)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">菜单图标</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysMenu.icon" value="${(po.icon)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">排序</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysMenu.sort" data-rule="排序编号:required" value="${(po.sort)!1}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">URL</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysMenu.url" value="${(po.url)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">URLKEY</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="sysMenu.urlkey" value="${(po.urlkey)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">类型</label>
                            <div class="col-md-10">
                                <select name="sysMenu.type"class="form-control select2">
                                    <option value="1" <#if 1==(po.type)!0>selected</#if>>菜单</option>
                                    <option value="2" <#if 2==(po.type)!0>selected</#if>>按钮</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">状态</label>
                            <div class="col-md-10">
                                <label><input type="radio" name="sysMenu.status" value="1" <#if 1==(po.status)!0 >checked</#if> /> 启用</label>
                                <label><input type="radio" name="sysMenu.status" value="0" <#if 2==(po.status)!0 >checked</#if> />禁用</label>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
</@view>
<script>
    $(function(){
        $(".select2").select2();
        ajaxForm($("#menuAddForm${nowtime}"),function(json){
            if(json.code==RESULT_SUCCESS){
                contentLoadPage('/menu');
            }else{
                if(json.msg)
                    layer.alert(json.msg,{icon:5,title:'系统提示',shadeClose:true});
            }
        });
    });
</script>